<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            textarea{
                width: 800px;
                resize: none;
                margin:0px auto;
                display: block;
                outline: none;
            }
            ul{
                width: 800px;
                margin:0px auto;
            }
            li{
                margin:20px 0px;
                border:1px solid blue;
                position: relative;
                padding:20px;
            }
            .del{
                position: absolute;
                right:-20px;
                top:-20px;
                cursor: pointer;
            }
            button{
                width: 800px;
                background:#f60;
                border:none;
                outline: none;
                display: block;
                margin:20px auto;
                line-height: 40px;
                color: white;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
    <textarea name="" id="txt" cols="30" rows="10"></textarea>
    <button id="btn">发送</button>
    <ul id="box">
        <li>
            放假第一天。
            <p>2021-06-12</p>
            <span class="del" onclick="del(this)">删除</span>
        </li>
        <li>
            端午节安康!!!
            <p>2021-06-13</p>
            <span class="del" onclick="del(this)">删除</span>
        </li>
    </ul>
    <script>
        var btn=document.getElementById('btn');
        var txt=document.getElementById('txt');
        var box=document.getElementById('box');
        var year=new Date().getFullYear()
        var month=new Date().getMonth()+1
        var date=new Date().getDate()
        btn.onclick=function(){
            var val=txt.value;
            var tag=document.createElement('li');
            tag.innerHTML=`${val}
            <p>${year}-${month}-${date}</p>
            <span class="del" onclick="del(this)">删除</span>`;
            box.appendChild(tag);
        }
        function del(a){
            a.parentNode.parentNode.removeChild(a.parentNode)
        }
    </script>
    </body>
</html>